<?php
class Zendvn_Model_Table_Group extends Zend_Db_Table{
	protected $_name = 'user_group';
	protected $_primary = 'id'; //Neu co nhieu khoa thi khai bao array('id1','id2',....)
	
	public function listItem($arrParam = null,$options = null){
		$result = $this->fetchAll(null,'id DESC')->toArray();
		return  $result;
	}
	
	public function saveItem($arrPram = null,$options = null){
		if($options['task'] == 'admin-add'){
			$row = $this->fetchNew();
							$row->name					= $arrPram['name'];
							$row->avatar				= $arrPram['avatar'];			
							$row->ranking				= $arrPram['ranking'];			
							$row->group_acp				= $arrPram['group_acp'];
							$row->group_default			= $arrPram['group_default'];	
							$row->created				= date('Y-M-d H:i:s');	
							$row->created				= 1;
							$row->permission			= $arrPram['permission'];
							$row->status				= $arrPram['status'];
							$row->order					= $arrPram['order'];
			$row->save();
		}
	}
}